package com.fsc.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fsc.entity.ResultWrapper;
import com.fsc.entity.domain.AnnRepoNews;
import com.fsc.entity.domain.LoginInfo;
import com.fsc.entity.dto.ModifyDTO;
import com.fsc.entity.dto.RegisterDTO;
import com.fsc.entity.vo.LoginUserVO;
import com.fsc.handler.BusinessException;
import com.fsc.service.LoginInfoService;
import com.fsc.mapper.LoginInfoMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import static com.fsc._enum.ReturnEnum.ANN_REPO_NEWS_NOT_EXIST;
import static com.fsc._enum.ReturnEnum.SUCCESS;

/**
* @author 86183
* @description 针对表【login_info(登录信息表)】的数据库操作Service实现
* @createDate 2024-06-02 13:15:22
*/
@Service
public class LoginInfoServiceImpl extends ServiceImpl<LoginInfoMapper, LoginInfo>
    implements LoginInfoService{

    @Autowired
    private LoginInfoMapper loginInfoMapper;
    public LoginUserVO updateUser(ModifyDTO modifyDTO){
        loginInfoMapper.updateLoginInfo(modifyDTO);
        LoginInfo loginInfo = loginInfoMapper.selectById(modifyDTO.getId());
        LoginUserVO loginUserVO = new LoginUserVO();
        BeanUtils.copyProperties(loginInfo, loginUserVO);
        loginUserVO.setUserId(loginInfo.getId());
        return loginUserVO;
    }

    @Override
    public int getRole(Integer loginId) {
        return this.baseMapper.getRoleById(loginId);
    }
}




